<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
        <title>演示：datepicker日期插件演示9种调用方法</title>
        <meta name="keywords" content="datepicker,jquery插件" />
        <meta name="description" content="之前我们提供了<a href='http://www.sucaihuo.com/js/119.html'>datetimepicker日期时间插件</a>，今天就介绍下日期插件datepicker。" />
        <link rel="stylesheet" type="text/css" href="http://www.sucaihuo.com/jquery/css/common.css" />
        <link rel="stylesheet" type="text/css" href="css/jquery-ui.css" />
        <style type="text/css">
            .stars{color:#ff6600;height:30px;line-height: 30px;font-size: 13px;margin: 0 0 20px}
            .tip{position:absolute;top:0;left:0;z-index:9999;border: 1px solid #D6D6D6;padding:5px 12px;background-color: #FFF;display: none;color:#FF6600;}
            .intro{margin-left:8px;color:#1B1B1B}
            .stars img{vertical-align: top;position: relative;top:4px;cursor:pointer;}
            .stars label{width:70px;display: inline-block;color:#333}
            .comment_title{width:45px;display: inline-block}
            .example{width:500px; margin:20px auto}
.example h4{height:32px; line-height:32px; font-size:14px}
.example h4 span{font-weight:500; font-size:12px}
.example p{line-height:28px;}
input{width:108px; height:20px; line-height:20px; padding:2px; border:1px solid #d3d3d3}
        </style>
    </head>
    <body>
        <div class="head">
            <div class="head_inner clearfix">
                <ul id="nav">
                    <li><a href="http://www.sucaihuo.com">首 页</a></li>
                    <li><a href="http://www.sucaihuo.com/templates">网站模板</a></li>
                    <li><a href="http://www.sucaihuo.com/js">网页特效</a></li>
                    <li><a href="http://www.sucaihuo.com/php">PHP</a></li>
                    <li><a href="http://www.sucaihuo.com/site">精选网址</a></li>
                </ul>
                <a class="logo" href="http://www.sucaihuo.com"><img src="http://www.sucaihuo.com/Public/images/logo.jpg" alt="素材火logo" /></a>
            </div>
        </div>
        <div class="container">
            <div class="demo">
                <h2 class="title"><a href="http://www.sucaihuo.com/js/160.html">教程：datepicker日期插件演示9种调用方法</a></h2>
                <div class="example">
                    <h4>1、默认格式：<span>yy-mm-dd</span></h4>
                    <p>日期：<input type="text" id="date_1" readonly /></p>
                </div>
                <div class="example" id="s2">
                    <h4>2、格式化日期：<span>yy年mm月dd日</span></h4>
                    <p>日期：<input type="text" id="date_2" readonly /></p>
                </div>
                <div class="example" id="s3">
                    <h4>3、设置日期可选范围：<span>当前日期前30天</span></h4>
                    <p>日期：<input type="text" id="date_3" readonly /></p>
                </div>
                <div class="example" id="s4">
                    <h4>4、关联同步不同的日期格式：</h4>
                    <p>日期：<input type="text" id="date_4" readonly /> &nbsp; <input type="text" id="alternate"  style="width:150px" /></p>
                </div>
                <div class="example">
                    <h4>5、直接显示日历：</h4>
                    <div id="datepicker"></div> 
                </div>
                <div class="example">
                    <h4>6、显示日期所在一年中的周数：</h4>
                    <p>日期：<input type="text" id="date_6" readonly /></p>
                </div>
                <div class="example" id="s7">
                    <h4>7、显示连续的3个月的日历：</h4>
                    <p>日期：<input type="text" id="date_7" readonly /></p>
                </div>
                <div class="example" id="s8">
                    <h4>8、通过点击图标触发显示日历：</h4>
                    <p>日期：<input type="text" id="date_8" readonly style="height:16px" /></p>
                </div>
                <div class="example" id="s9">
                    <h4>9、选中日期后触发事件：</h4>
                    <p>日期：<input type="text" id="date_9" readonly /></p>
                </div>
            </div>
        </div>
        <div class="foot">
            Powered by sucaihuo.com  本站皆为作者原创，转载请注明原文链接：<a href="http://www.sucaihuo.com" target="_blank">www.sucaihuo.com</a>
        </div>
        <script type="text/javascript" src="http://www.sucaihuo.com/Public/js/other/jquery.js"></script>
        <script type="text/javascript" src="js/jquery-ui-datepicker.js"></script>
        <script type="text/javascript">
            $(function() {
                $("#date_1").datepicker();
                $("#date_2").datepicker({
                    //navigationAsDateFormat: true,
                    dateFormat: 'yy年mm月dd日'
                });
                $("#date_3").datepicker({
                    minDate: -30,
                    maxDate: 0
                });
                $("#date_4").datepicker({
                    altField: "#alternate",
                    altFormat: "yy年MMd日,DD"
                });
                $("#datepicker").datepicker({
                    showOtherMonths: true,
                    selectOtherMonths: false
                });
                $("#date_6").datepicker({
                    showWeek: true
                });
                $("#date_7").datepicker({
                    numberOfMonths: 3,
                    showButtonPanel: true
                });
                $("#date_8").datepicker({
                    showOn: "button",
                    buttonImage: "images/calendar.gif",
                    buttonImageOnly: true
                });
                $("#date_9").datepicker({
                    onSelect: function(dateText, inst) {
                        alert("您选择的日期是：" + dateText)
                    }
                });
            });
        </script>
    </body>
</html>